<template>
  <div class="news" style="margin-top: 80px">
    <!-- 侧导航 -->
    <side-navigation />

    <public-txt id="NEWs">
      <h1 slot="c-txt">新闻中心</h1>
      <p slot="e-txt">News center</p>
    </public-txt>

    <new-tab-bar />

    <router-view />

    <floor />
  </div>
</template>
<script>
import SideNavigation from "components/SideNavigation/SideNavigation";
import PublicTxt from "components/PublicTxt/PublicTxt";
import Floor from "components/Floor/Floor";
import NewTabBar from "./newsTabBar/NewTabBar";

export default {
  components: {
    SideNavigation,
    PublicTxt,
    NewTabBar,
    Floor,
  },
  mounted() {
    this.$store.commit("i1click");
    // console.log(this.$route);
    document.querySelector(`#${this.$route.query.id}`).scrollIntoView(true);
  },
  watch: {
    "$route.query.id": (newVal, oldVal) => {
      console.log(newVal, oldVal);
      document.querySelector(`#${newVal}`).scrollIntoView(true);
      this.$store.commit("i1click");
    },
  },
};
</script>

<style lang="less" scoped>
</style>